package com.etrans.web.gps.business.report.controller;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.etrans.web.gps.base.controller.BaseController;
import com.etrans.web.gps.business.report.service.NotificationService;

/**
 * 系统每月通报Controller
 * @author 
 * 2018/10/08
 */
@Controller
@RequestMapping("/report/notification/*")
public class NotificationController extends BaseController{
	
	@Autowired
	private NotificationService notiService;
	
	/**
	 * 页面跳转入口
	 * @return
	 */
	@RequestMapping("toNotification.html")
	public String vehicleDrivingAnaOpen(){
		return "views/business/report/notification";
	}
	
	/**
	 * 入网率低于99%的业户明细/上线率低于90%的业户明细/
	 * 数据合格率低于99%的业户明细/轨迹完整率低于90%的业户明细
	 * @param queryTime
	 * @return
	 */
	@RequestMapping("loadTableData.html")
	@ResponseBody
	public Map<String, Object> loadTableData(String queryTime){
		Map<String, Object> map = new HashMap<>();
		map.put("access", notiService.loadTableData(queryTime, 1));
		map.put("online", notiService.loadTableData(queryTime, 2));
		map.put("correct", notiService.loadTableData(queryTime, 3));
		map.put("complete", notiService.loadTableData(queryTime, 4));
		return map;
	}
	
	/**
	 * 超速报警次数最多的10家运输企业/超速报警次数最多的10辆车辆/
	 * 疲劳驾驶总时长最多的前10家运输企业/疲劳驾驶时长最多的前10辆车辆
	 * @param queryTime
	 * @return
	 */
	@RequestMapping("loadTableDetailData.html")
	@ResponseBody
	public Map<String, Object> loadTableDetailData(String queryTime){
		Map<String, Object> map = new HashMap<>();
		map.put("access", notiService.loadTableDetailData(queryTime, 5));
		map.put("online", notiService.loadTableDetailData(queryTime, 6));
		map.put("correct", notiService.loadTableDetailData(queryTime, 7));
		map.put("complete", notiService.loadTableDetailData(queryTime, 8));
		return map;
	}
}
